﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProductLaunch.aspx.cs" Inherits="GS_OM.Pages.ProductLaunch" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="../files/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../files/css/main.css" rel="stylesheet" />
    <link href="../files/css/animate.min.css" rel="stylesheet" />
</head>
<body class="tran_lg npl_lg">

    <div class="_info">
        <div class="_title ">
            <img src="../files/img/small_img/nav_img/new_product_launch.png" id="pro_title" /><span>新品发布</span>
            <div class="widget-content table_btn fr preview ">
                <a class="btn btn-s-md btn-default " href="#">预览</a>
            </div>
        </div>
        <div class="npl_body center">
            <span id="pro_prompt">编辑您新产品的信息</span>
            <input type="hidden" name="name" id="txt_Type" />
            <input type="hidden" name="name" id="txt_ID" />
            <hr />
            <table class="center">
                <tr>
                    <td valign="top" class="tab_title" id="lb_Prod_ID">商品编号</td>
                    <td>
                        <input type="text" id="txt_Prod_ID" name="name" value=" " /></td>
                </tr>
                <tr>
                    <td valign="top" class="tab_title" id="lb_Name">商品名称</td>
                    <td>
                        <input type="text" id="txt_Name" name="name" value=" " />
                    </td>
                </tr>
                <tr>
                    <td valign="top" class="tab_title" id="lb_Msg">商品描述</td>
                    <td>
                        <textarea id="txt_Msg" style="overflow: hidden"></textarea></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <p style="margin: 8px 0px;">* 图片请上传512*512的图片</p>
                        <form id='FormUpImg1' name='FormUpImg1' method="post" action='Uploads.aspx' target='FrameImg1'
                            enctype="multipart/form-data">
                            <a id="upload1" href="javascript:void(0)" class="widget-content ft upload_img" onclick="fileClick(1)">
                                <img src="../files/img/small_img/nav_img/upload_photo.png" />
                                <hr />
                                <input type="file" id='FileUpImg1' name='FileUpImg1' style="display: none;" onchange="upload(1)" />
                                <div id='UploadLogImg1'>
                                    上传商品图片
                                </div>
                            </a>
                            <input type="hidden" id="ProductImg1" />
                        </form>
                        <iframe id='FrameImg1' name='FrameImg1' style='display: none;'></iframe>

                        <form id='FormUpImg2' name='FormUpImg2' method="post" action='Uploads.aspx' target='FrameImg2'
                            enctype="multipart/form-data">
                            <a id="upload2" class="widget-content ft upload_img" href="javascript:void(0)" onclick="fileClick(2)">
                                <img src="../files/img/small_img/nav_img/upload_photo.png" />
                                <hr />
                                <input type="file" id='FileUpImg2' name='FileUpImg2' style="display: none;" onchange="upload(2)" />
                                <div id='UploadLogImg2'>
                                    上传商品图片
                                </div>
                            </a>
                            <input type="hidden" id="ProductImg2" />
                        </form>
                        <iframe id='FrameImg2' name='FrameImg2' style='display: none;'></iframe>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <form id='FormUpImg3' name='FormUpImg3' method="post" action='Uploads.aspx' target='FrameImg3'
                            enctype="multipart/form-data">
                            <a id="upload3" class="widget-content ft upload_img" href="javascript:void(0)" onclick="fileClick(3)">
                                <img src="../files/img/small_img/nav_img/upload_photo.png" />
                                <hr />
                                <input type="file" id='FileUpImg3' name='FileUpImg3' style="display: none;" onchange="upload(3)" />
                                <div id='UploadLogImg3'>
                                    上传商品图片
                                </div>
                            </a>
                            <input type="hidden" id="ProductImg3" />
                        </form>
                        <iframe id='FrameImg3' name='FrameImg3' style='display: none;'></iframe>
                        <form id='FormUpImg4' name='FormUpImg4' method="post" action='Uploads.aspx' target='FrameImg4'
                            enctype="multipart/form-data">
                            <a id="upload4" class="widget-content ft upload_img" href="javascript:void(0)" onclick="fileClick(4)">
                                <img src="../files/img/small_img/nav_img/upload_photo.png" />
                                <hr />
                                <input type="file" id='FileUpImg4' name='FileUpImg4' style="display: none;" onchange="upload(4)" />
                                <div id='UploadLogImg4'>
                                    上传商品图片
                                </div>
                            </a>
                            <input type="hidden" id="ProductImg4" />
                        </form>
                        <iframe id='FrameImg4' name='FrameImg4' style='display: none;'></iframe>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="widget-content table_btn fr submit">
                            <a id="save" class="btn btn-s-md btn-default preview" onclick="submitProduct('Saved')">存储</a>
                        </div>
                        <div class="widget-content table_btn fr submit">
                            <a id="submit" class="btn btn-s-md btn-default preview"  onclick="submitProduct('No')">提交</a>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <script src="../files/javascript/jquery-1.10.2.min.js"></script>
    <script src="../files/js/main.js"></script>
    <script>
        $(function () {
           
            var type = GetQueryString("type");
            $("#txt_Type").val(type);
            switch (type) {
                case "NewProd":
                    $("#pro_title").attr("src", "../files/img/small_img/nav_img/new_product_launch.png");
                    $("#pro_title").next("span").text("新品发布");
                    $("#pro_prompt").text("编辑您的新产品的信息");
                    break;
                case "Discount":
                    $("#pro_title").attr("src", "../files/img/small_img/nav_img/discounted_products.png");
                    $("#pro_title").next("span").text("打折商品");
                    $("#pro_prompt").text("编辑您打折的信息");
                    break;
                case "updatePro":
                    $("#pro_title").attr("src", "../files/img/small_img/nav_img/edit.png");
                    $("#pro_title").next("span").text("修改商品信息");
                    $("#pro_prompt").text("编辑您修改的的信息"); 
                    bindUpdateInfo();
                    break;
                case "Activities":
                    $("#pro_title").attr("src", "../files/img/small_img/nav_img/market_activity.png");
                    $("#pro_title").next("span").text("商场活动");
                    $("#pro_prompt").text("编辑您的活动信息");
                    $("#lb_Prod_ID").parent().hide();
                    $("#lb_Name").text("活动名称");
                    $("#lb_Msg").text("活动描述");
                    break;
            }
        })
        function bindUpdateInfo() {
            var id = GetQueryString("ID");
            $.ajax({
                type: "get",
                datatype: "text",
                data:"ID="+id,
                url: "../SMHandler/GetProductHandler.ashx",
                success: function (data) {
                    var Push = JSON.parse(data.split('-')[0]);
                    var PushImg = JSON.parse(data.split('-')[1]);
                    $("#txt_ID").val(Push["Push_ID"]);
                    $("#txt_Prod_ID").val(Push["Push_Prod_ID"]);
                    $("#txt_Name").val(Push["Push_Name"]);
                    $("#txt_Msg").val(Push["Push_Msg"]);
                    $("#txt_Type").val(Push["Push_Type"]);
                    $("#txt_Approval").val(Push["Push_Approval"]);
                    for (var i = 0; i < PushImg.length; i++) {
                        $("#upload" + (i + 1)).css('background', "url('" + PushImg[i].Res_Path + "') no-repeat 100%")
                    }
                }
            })
        }
    </script>
</body>
</html>
